/*
 * @description: 描述内容
 */
import { useState, useEffect } from "react";
//模拟异步获取的数据
async function getTableList() {
    const data = await new Promise<number>((resolve) => {
        setTimeout(() => {
            resolve(12580);
        }, 3000)
    })

    return data;
}



function App() {
    console.count('APP函数执行的次数')
    const [count, setCount] = useState(0);
    //希望得到的结果getTableList 只会在组件第一次渲染时调用一次
    useEffect(() => {
        console.count('useEffect执行的次数')
        getTableList().then(res=>{
            setCount(res);
        })
    }, [])

    return (
        <div>
            <div>
                {count}
            </div>
        </div>
    )
}


export default App